﻿@inject AccentBaseColor AccentBaseColor

<FluentMenuButton @ref=menubutton Text="Select brand color" Items="@items" OnMenuChanged="HandleOnMenuChanged"></FluentMenuButton>

@code {
    private FluentMenuButton menubutton = new();

    private Dictionary<string, string> items = new Dictionary<string, string>()
    {
        {"0078D4","Windows"},
        {"D83B01","Office"},
        {"464EB8","Teams"},
        {"107C10","Xbox"},
        {"8661C5","Visual Studio"},
        {"F2C811","Power BI"},
        {"0066FF","Power Automate"},
        {"742774","Power Apps"},
        {"0B556A","Power Virtual Agents"}
    };

    private async Task HandleOnMenuChanged(MenuChangeEventArgs args)
    {
        await AccentBaseColor.SetValueFor(menubutton.Button!.Element, $"#{args.Id}".ToSwatch());
    }

}
